package com.ruoyi.project.jxc.service.impl;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.project.jxc.mapper.JxcMfMapper;
import com.ruoyi.project.jxc.service.IJxcMfService;
import com.ruoyi.project.jxc.domain.JxcMf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class JxcMfServiceImpl implements IJxcMfService {
    @Autowired
    private JxcMfMapper jxcMfMapper;
    @Override
    public List<JxcMf> selectMfList(JxcMf mf) {
        return jxcMfMapper.selectMfList(mf);
    }

    @Override
    public int insertMf(JxcMf mf) {
        return jxcMfMapper.insertMf(mf);
    }

    @Override
    public String checkMfNameUnique(JxcMf mf) {
        JxcMf jxcMf = jxcMfMapper.checkMfNameUnique(mf.getMfName());
        if(mf.equals(jxcMf)){
            return UserConstants.NOT_UNIQUE;
        }
        return UserConstants.UNIQUE;
    }

    @Override
    public JxcMf selectMfById(Long mfId) {
        return jxcMfMapper.selectMfById(mfId);
    }

    @Override
    public int updateMf(JxcMf mf) {
        return jxcMfMapper.updateMf(mf);
    }

    @Override
    public int deleteMfById(Long[] mfId) {
        return jxcMfMapper.deleteMfById(mfId);
    }

    @Override
    public List<JxcMf> selectMfAll() {
        return jxcMfMapper.selectMfList(new JxcMf());
    }


}
